<?php
// avoid excuted from web[http://].
if( isset($_SERVER['REQUEST_METHOD']) ) {
    echo "<html><body>Permission denied.</body></html>\n";
    exit();
}
require_once(dirname(__FILE__).'/../../../../inc/class/init.php');
WF::initCLI($argv, $argc);
//create object WFExitCode and include_file /path/to/ExitCode.php
$objExitCode = WF::getConfigFactory()->getExitCode();
$file_interface = basename(__FILE__);
/*
 * php.exe
 * execDBUpdateFilter.php $argv[0]
 * ...
 * 
 */
//var_dump($argc);exit();

if($argc < 1 ){
	$objExitCode->exitCli( WFExitCode::ERROR_WRONG_PARAMETER ,$file_interface);
}else if((isset($argv[1]) && in_array ( $argv[1], array ('--help', '-help', '-h', '-?' ) ))){
	$objExitCode->exitCli( WFExitCode::SHOW_HELP ,$file_interface);
} else {
	try{
	    WF::getWidgetFactory()->getInterface()->execDBUpdateFilter();
	} catch (Exception $e) {
	    $msg = $e->getMessage();
	    myerror_log($msg);
	    $objExitCode->exitCli(WFExitCode::ERROR_EXEC_DB_UPDATE_FILTER, null, $msg);
	}
	$objExitCode->exitCli(WFExitCode::SUCCESS);
}